package sxe.core.cs511.team2_2;

/**OVERVIEW: This class corresponds to a region of interest in an image.
 * Each blob location is described by the x,y locataion of the top left corner of its bounding box and the width and height of its bounding box.
 * The abstraction function is AF(c)={int (x, y), int (height, width), collection of features}
 * The rep invariant is that the blob object contains valid blobs in a frame.
 * @author wajeeha
 */
  
public class Blob {
	/** bounding box */
	private java.awt.Rectangle rectangle;
	/** time stamp */
	private java.util.Date date;
	/** description of blob */
	private BlobDescription description;
	
	/**
	 * EFFECTS sets the x (column of top left corner), y(row of top left corner), height and width of the rectangle enclosing the blob to the values passed
	 * MODIFIES rectangle
	 */
	public Blob(int setx, int sety, int seth, int setw){ 
		rectangle=new java.awt.Rectangle(setx,sety,setw,seth);
		date=java.util.Calendar.getInstance().getTime();
	}
	/**
	 * EFFECTS sets the rectangle enclosing the blob to the value passed
	 * MODIFIES rectangle
	 */
	public Blob(java.awt.Rectangle rect){ 
		rectangle=rect;
		date=java.util.Calendar.getInstance().getTime();
	}
	/**
	 * EFFECTS sets the rectangle enclosing the blob and the blob description to the values passed. Also sets time of creation of the blob  to the current system time
	 * MODIFIES rectangle, desc, date
	 */
	public Blob(BlobDescription desc,java.awt.Rectangle rect){ 
		rectangle=rect;
		description=desc;
		date=java.util.Calendar.getInstance().getTime();
	}
	/**
	 * EFFECTS sets the rectangle enclosing the blob, the blob description and the time stamp of the blob to the values passed. 
	 * MODIFIES rectangle, desc, date
	 */
	public Blob(BlobDescription desc,java.awt.Rectangle rect,java.util.Date d){ 
		rectangle=rect;
		description=desc;
		date=d;
	}
	/**
	 * EFFECTS returns the time stamp associated with the blob
	 */
	public java.util.Date getStamp(){
		return date;
	}
	
	/**
	 * EFFECTS returns x (the column of the top left corner of bounding rectangle)
	 */
	public int getX(){
		return rectangle.x;
	}
	
	/**
	 * EFFECTS returns y (the row of the top left corner of bounding rectangle)
	 */
	public int getY(){
		return rectangle.y;
	}
	
	/**
	 * EFFECTS returns blob width
	 */
	public int getWidth(){
		return rectangle.width;
	}
	
	/**
	 * EFFECTS returns blob height
	 */
	public int getHeight(){
		return rectangle.height;
	}
	/** 
	 * EFFECTS: returns blob descriptor if given during constructor, otherwise null
	 */
	public BlobDescription getDescription(){
		return description;
	}

}
